import { NextRequest } from "next/server";

export async function GET(
    request: NextRequest,
    { params }: { params: Promise<{ slug: string }> }
) {
    const slug = (await params).slug; // 'a', 'b', or 'c'
    const searchParams = request.nextUrl.searchParams;
    const query = searchParams.get("query");
    return Response.json({
        query,
        params: [...searchParams.entries()].reduce((prev, [key, value]) => {
            prev[key] = value;
            return prev;
        }, {} as Record<string, string>),
        slug,
    });
}
